form.on('@if(!isset($id) && empty($id))submit(postForm)@else{{$id}}@endif', function(data){
    var method = $(":input[name='_method']").val();
    if (method != 'put') {
        method = 'post';
    }
    $.ajax({
        url:@if(!isset($url))$('.layui-form').attr('action')@else'{{$url}}'@endif,
        data:data.field,
        type:method,
        dataType:'json',
        success:function(response){
            if(response.code == 0){
                @if(isset($call))
                    {{$call}};
                @else
                    parent.layer.msg(response.message,{icon:1});
                    if(response.jump != ''){
                        location.href = response.jump;
                    }
                @endif
            } else {
                parent.layer.msg(response.message,{icon:2});
            }
        }
    });
    return false;
});

@if(isset($call))
    $('#close').click(function () {
        close();
    });

    function close(reload){
        if(typeof(reload) !== 'undefined') {
            window.parent.location.reload();
        }
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
@endif